package com.burgeon.backend.Controller;


import com.burgeon.backend.service.FromToolService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;


@RestController
@RequestMapping("tool")
public class FromToolController extends BaseController {

    @Autowired
    private FromToolService fromToolService;

    @RequestMapping("customer")
    public ResponseResult<List> Getcustomer(HttpSession session) {
        String account = session.getAttribute("account").toString();
        List list = fromToolService.GetCustomer(account);
        return new ResponseResult<List>(SUCCESS, list);
    }

    @RequestMapping("store")
    public ResponseResult<List> GetArea(String name,HttpSession session) {
        String account = session.getAttribute("account").toString();
        List list = fromToolService.GetStore(name,account);
        return new ResponseResult<List>(SUCCESS, list);
    }

    @RequestMapping("emp")
    public ResponseResult<List> GetEMP(String name, HttpSession session) {
        String account = session.getAttribute("account").toString();
        List list = fromToolService.GetEMP(name,account);
        return new ResponseResult<List>(SUCCESS, list);
    }

    @RequestMapping("area")
    public ResponseResult<List> GetArea(HttpSession session) {
        String token = session.getAttribute("token").toString();
        List list = fromToolService.GetRegion(token);
        return new ResponseResult<List>(SUCCESS, list);
    }
    @RequestMapping("viptype")
    public ResponseResult<String> GetVipType(HttpSession session) {
        String token = session.getAttribute("token").toString();
        String data = fromToolService.GetMVIPTYPE(token);
        return new ResponseResult<String>(SUCCESS, data);
    }

}
